Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

global-agent

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

global-agent

Global HTTP/HTTPS proxy configurable using environment variables.

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3M
increased by16.2%
Maintainers
1
Weekly downloads
 
Created

What is global-agent?

The global-agent npm package is a global HTTP/HTTPS proxy agent that is capable of managing multiple active connections efficiently. It is primarily used to enable proxy support in Node.js applications in a global manner, meaning it can intercept and route outgoing HTTP and HTTPS requests through a specified proxy server. This is particularly useful for applications that need to operate behind corporate proxies or when you want to route traffic for purposes like anonymization.

What are global-agent's main functionalities?

Global HTTP/HTTPS proxy configuration

This code configures a global HTTP proxy for all outgoing HTTP requests. It sets up the proxy server address and specifies hosts for which the proxy should not be used (NO_PROXY). This is useful for applications that need to route their HTTP requests through a proxy server.

require('global-agent/bootstrap');

process.env.GLOBAL_AGENT_HTTP_PROXY = 'http://127.0.0.1:8080';
process.env.GLOBAL_AGENT_NO_PROXY = 'localhost,127.0.0.1';

require('global-agent').createGlobalProxyAgent();

Environment variable configuration

This code demonstrates how to configure both HTTP and HTTPS proxies using environment variables. It allows the application to send all HTTP and HTTPS requests through the specified proxies.

require('global-agent/bootstrap');

process.env.GLOBAL_AGENT_HTTPS_PROXY = 'https://proxy.example.com:443';
process.env.GLOBAL_AGENT_HTTP_PROXY = 'http://proxy.example.com:8080';

Other packages similar to global-agent

Keywords

FAQs

Package last updated on 23 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc